package com.hgf.helper.mybatisplusdemo.helper;

import com.hgf.helper.mybatisplusdemo.db.entity.Student;
import com.hgf.helper.mybatisplusdemo.db.service.StudentServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

@Component
public class Web2Helper {

    @Autowired
    StudentServiceImpl studentService;

    @Transactional(rollbackFor = Exception.class)
    public void b(){
        try {
            studentService.updateTargetFieldById(Student::getName, "测试修改2", 13);
            throw new RuntimeException();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }

    }

}
